import java.io.File;
import java.io.IOException;

public class FileDemo5 {
    public static void main(String[] args) throws IOException, InterruptedException {
        File file=new File("a.txt");
        if(!file.exists()){
            //如果不存在
            System.out.println("新建文件："+file.createNewFile());
        }

        //删除文件
        file.deleteOnExit();
        Thread.sleep(5000);
    }
}
